import { FormType, IMyFormProps, IOptions } from '@/base-ui/base-form/type'
import { ActionDesc, PagesKey } from '@/global/constant'

const getQuestionListSearch = ([
  options1 = [],
  options2 = [],
  options3 = []
]: IOptions[][] = []): IMyFormProps => {
  const config: IMyFormProps = {
    pageKey: PagesKey.QuestionList,
    desc: ActionDesc.QuestionSearch,
    layout: { span: 7 },
    formConfig: {
      name: 'wrap',
      size: 'middle',
      labelAlign: 'right',
      labelCol: { flex: '80px', offset: 2 },
      colon: false
    },
    itemsConfig: [
      {
        type: FormType.Select,
        prop: 'classifyFirstId',
        label: '一级分类',
        name: 'classifyFirstId',
        select: {
          baseProps: {
            placeholder: '请选择一级分类',
            size: 'small'
          },
          options: options1
        }
      },
      {
        type: FormType.Select,
        prop: 'classifySecondId',
        label: '二级分类',
        name: 'classifySecondId',
        select: {
          baseProps: {
            placeholder: '请选择二级分类',
            size: 'small'
          },
          options: options2
        }
      },
      {
        type: FormType.Select,
        prop: 'classifyThirdId',
        label: '三级分类',
        name: 'classifyThirdId',
        select: {
          baseProps: {
            placeholder: '请选择三级分类',
            size: 'small'
          },
          options: options3
        }
      },
      {
        type: FormType.Select,
        prop: 'questionType',
        label: '题目类型',
        name: 'questionType',
        select: {
          baseProps: {
            placeholder: '请选择题目类型',
            size: 'small'
          },
          options: [
            { value: 0, content: '单选题' },
            { value: 1, content: '多选题' },
            { value: 2, content: '判断题' }
          ]
        }
      },
      {
        type: FormType.Input,
        prop: 'questionTitle',
        label: '题目',
        name: 'questionTitle',
        input: {
          placeholder: '请输入题目'
        }
      }
    ]
  }

  return config as IMyFormProps
}

export default getQuestionListSearch
